package com.jackrain.nea.fc.cp.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.HashMap;
import java.util.List;

/**
 * 店仓人员状态查询
 * Mapper
 *
 * @author xuxinshuai
 * @create 2018/01/26
 */
@Mapper
public interface ViewStoreEmpMapper {


    /**
     * @return List
     */
    @Select(" SELECT  b.ENAME AS orgename , a.ECODE AS storeecode,a.ENAME AS storeename FROM CP_C_STORE a ,CP_C_HRORG  b WHERE  a.STORENATURE='STO' AND a.ISACTIVE='Y' AND a.CP_C_DISTRIB_ID IS NULL AND  a.CP_C_HRORG_ID=b.ID ORDER BY b.ENAME ")
    List<HashMap> selectStoreState();


    /**
     * @return List
     */
    @Select(" SELECT  b.ENAME  AS orgename ,count(b.ENAME) enamecount  FROM CP_C_STORE a ,CP_C_HRORG  b WHERE  a.STORENATURE='STO' AND a.ISACTIVE='Y' AND a.CP_C_DISTRIB_ID IS NULL AND  a.CP_C_HRORG_ID=b.ID GROUP BY b.ENAME ORDER BY count(b.ENAME) DESC ")
    List<HashMap> selectOrgCountState();

    /**
     * @return List
     */
    @Select("SELECT    b.ENAME  AS orgename ,count(b.ENAME) enamecount FROM CP_C_EMP a,CP_C_HRORG  b WHERE HR003_ID IS NOT NULL AND CP_C_DISTRIB_ID IS NULL AND a.ISACTIVE='Y' AND a.CP_C_HRORG_ID=b.ID GROUP BY b.ENAME ORDER BY count(b.ENAME) DESC ")
    List<HashMap> selectEmpCpunt();


    /**
     * @return List
     */
    @Select("SELECT  b.ENAME AS orgename , a.ECODE AS empecode,a.ENAME AS empename FROM CP_C_EMP a,CP_C_HRORG  b WHERE HR003_ID IS NOT NULL AND CP_C_DISTRIB_ID IS NULL AND a.ISACTIVE='Y' AND a.CP_C_HRORG_ID=b.ID ORDER BY b.ENAME ASC ")
    List<HashMap> selectEmpState();


}
